package com.inmerweb.app.domain;

import java.util.List;




import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;



import com.inmerweb.app.commons.BaseEntity;

/**
 * Entidad para representar la informacion de usuario
 * 
 * @author Daniel Pascual Sanchez
 *
 */

@Entity
@Table(name = "appusers")
public class UserEntity extends BaseEntity {

	private static final long serialVersionUID = 3089621305760832873L;
	
	private String firstName;
	
	private String lastName;
	
	private String userName;
	
	private String password;
	
	
	private List<InmersionEntity> inmersionList; // uno-a-muchas inmersiones, geter OneToMany

	
	
	
	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	//@OneToMany(mappedBy = "user",fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	@OneToMany(mappedBy = "user",fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	public List<InmersionEntity> getInmersionList() {
		return inmersionList;
	}
	
	public void setInmersionList(List<InmersionEntity> inmersionList) {
		this.inmersionList = inmersionList;
	}
	
	public void addInmersionToInmersionList(InmersionEntity inmersion){
		//if(!this.inmersionList.contains(inmersion)){
			this.inmersionList.add(inmersion);
		//}
	}

}
